import Vuex from 'vuex'
import Vue from 'vue'

// 注册插件
Vue.use(Vuex)

// 构建vuex仓库
const store = new Vuex.Store({
  state: {
    userInfo: {
      userName: '黑马1'
    }
  },
  mutations: {
    changeUser (state, payload) {
      state.userInfo.userName = payload
      // state.userInfo = payload
      // console.log(payload)
      // console.log(state)
    }
  }
})

console.log(store)

export default store
